<template>
	<view class="container container329916">
		<view v-if="data.code == 200" class="flex flex-wrap diygw-col-24 flex-direction-column">
			<view class="flex flex-wrap diygw-col-24 flex-direction-column justify-center items-center flex6-clz">
				<text class="diygw-col-24 text11-clz">
					{{ data.data.title }}
				</text>
				<image :src="data.data.img" class="response diygw-col-24 image-clz" mode="widthFix"></image>
				<text class="diygw-text-line3 diygw-col-24">
					{{ data.data.remark }}
				</text>
				<mp-html :content="data.data.content" class="diygw-col-24"></mp-html>
			</view>
		</view>
		<view class="clearfix"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//用户全局信息
				userInfo: {},
				//页面传参
				globalOption: {},
				//自定义全局变量
				globalData: { isshow: false },
				dataNum: 1,
				data: {
					code: 0,
					msg: '',
					data: {
						id: 0,
						title: '',
						remark: '',
						img: '',
						content: null,
						cateId: 0,
						userId: 0,
						createTime: '',
						updateTime: '',
						deleteTime: null
					}
				}
			};
		},
		onShow() {
			this.setCurrentPage(this);
		},
		onLoad(option) {
			this.setCurrentPage(this);
			if (option) {
				this.setData({
					globalOption: this.getOption(option)
				});
			}

			this.init();
		},
		methods: {
			async init() {
				this.dataApi();
			},
			// 文章数据 API请求方法
			async dataApi(param) {
				let thiz = this;
				param = param || {};

				//请求地址及请求数据，可以在加载前执行上面增加自己的代码逻辑
				let http_url = '/cms/api.article/get';
				let http_data = {
					pageNum: this.dataNum,
					pageSize: 10,
					id: param.id || this.globalOption.id || '1'
				};
				let http_header = {};

				let data = await this.$http.post(http_url, http_data, http_header, 'json');

				if (!data.data) {
					this.showToast('详情不存在');
					uni.navigateBack();
					return;
				}

				this.data = data;
				this.globalData.isshow = true;
				uni.setNavigationBarTitle({
					title: data.data.title
				});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.flex6-clz {
		padding-top: 10rpx;
		border-bottom-left-radius: 12rpx;
		padding-left: 10rpx;
		padding-bottom: 10rpx;
		border-top-right-radius: 12rpx;
		margin-right: 20rpx;
		background-color: #ffffff;
		margin-left: 20rpx;
		overflow: hidden;
		width: calc(100% - 20rpx - 20rpx) !important;
		border-top-left-radius: 12rpx;
		margin-top: 10rpx;
		border-bottom-right-radius: 12rpx;
		margin-bottom: 10rpx;
		padding-right: 10rpx;
	}
	.text11-clz {
		font-weight: bold;
		font-size: 28rpx !important;
		text-align: center;
	}
	.image-clz {
		border-bottom-left-radius: 12rpx;
		overflow: hidden;
		border-top-left-radius: 12rpx;
		border-top-right-radius: 12rpx;
		border-bottom-right-radius: 12rpx;
	}
	.container329916 {
	}
</style>
